package ink.yuanchu.picachoframework.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.Version;
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.gitee.sunchenbin.mybatis.actable.annotation.IsKey;
import com.gitee.sunchenbin.mybatis.actable.annotation.IsNotNull;
import com.gitee.sunchenbin.mybatis.actable.annotation.Table;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Date;

/**
 * Created with IntelliJ IDEA.
 *
 * @author ziyuan
 * @Date: 2021/04/02/16:04
 * @Description:
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="File对象", description="文件")
@Table
public class File {

    /**
     * 序列化id
     */
    private static final long serialVersionUID = 1L;

    /**
     * 主键id
     */
    @IsKey
    @Column(comment = "主键id")
    private String id;

    /**
     * 真实名称  根据uuid生成的名称
     */
    @IsNotNull
    @Column(comment = "真实名称")
    private String trueName;

    /**
     * 对外名称 上传时的名称
     */
    @IsNotNull
    @Column(comment = "对外名称")
    private String externalName;

    /**
     * 格式
     */
    @Column(comment = "格式")
    private String format;

    /**
     * 文件大小
     */
    @Column(comment = "文件大小")
    private String size;

    /**
     * 逻辑删除值
     */
    @TableLogic
    @Column(comment = "逻辑删除")
    private int deleted;

    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    @Column(comment = "创建时间",type = MySqlTypeConstant.DATETIME)
    private Date createTime;

    /**
     * 更新时间
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @Column(comment = "更新时间",type = MySqlTypeConstant.DATETIME)
    private Date updateTime;

    /**
     * 乐观锁
     */
    @Version
    @TableField(fill = FieldFill.INSERT)
    @Column(comment = "乐观锁")
    private Integer version;
}
